<?php
declare (strict_types=1);

namespace app\exam\service;

use think\facade\Request;
use app\common\service\BaseService;
use app\exam\logic\Special as SpecialLogic;
use app\exam\logic\Point as PointLogic;

/**
 * 专项服务类
 */
class Special extends BaseService
{

	/**
	 * 获取专项列表
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-04
	 * @return [type] [description]
	 */
	public function getSpecialList()
	{
		$param = Request::get();
		$data  = app(SpecialLogic::class)->getSpecialList($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 搜索专项列表
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-04
	 * @return [type] [description]
	 */
	public function search()
	{
		$param = Request::get();
		$data  = app(SpecialLogic::class)->search($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 获取指定专项的试题基础信息
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-04
	 * @return [type] [description]
	 */
	public function getSpecialBase()
	{
		$param = Request::get();
		$data  = app(SpecialLogic::class)->getSpecialBase($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 获取试题信息及选项
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-04
	 * @return [type] [description]
	 */
	public function getSpecialTopic()
	{
		$param = Request::get();
		$data  = app(SpecialLogic::class)->getSpecialTopic($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 提交练习答案
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-04
	 * @return [type] [description]
	 */
	public function postSpecialAnswer()
	{
		$param = Request::post();
		app(SpecialLogic::class)->postSpecialAnswer($param);

		return $this->parseToData([], 1, '提交成功');
	}

	/**
	 * 清空专项记录
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-06-04
	 * @param  string $value [description]
	 * @return [type]        [description]
	 */
	public function clearSpecialRecord()
	{
		$param = Request::delete();
		app(SpecialLogic::class)->clearSpecialRecord($param);

		return $this->parseToData([], 1, '成功');
	}

}
